import { defineStore } from 'pinia'
import { ref } from 'vue'
import { User } from '@/types/user'

export const useUserStore = defineStore('user', () => {
    const userInfo = ref<User>()
    //保存用户信息
    const setUserInfo = (val) => {
        userInfo.value = val
    }

    return {
        userInfo, setUserInfo
    }
},
    {
        persist: {
            key: 'vue3-pc',
            storage: localStorage
        }
    }
)
